"""
  Copyright (c) 2024 Northeastern University (China)
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
"""
import os
import click
import yaml
# 当前文件的路径
g_cur_dir = os.path.dirname(os.path.abspath(__file__))
# 当前文件的父路径
father_path = os.path.dirname(g_cur_dir)
@click.command()
@click.option('--env', type=str, required=True,help='Environment name (e.g., construction_DB,component_detector)')
def update_config(env):
    with open(os.path.join(g_cur_dir, 'config.yml'), 'r', encoding="UTF-8") as file:
        config = yaml.safe_load(file)
        # Update the configuration based on command line arguments
    if env:
        config['env'] = env
    with open(os.path.join(g_cur_dir, 'config.yml'), 'w') as file:
        yaml.dump(config, file)


if __name__ == '__main__':
    update_config()